package cn.joeg.dp.decorator.passport.upgrade;

import cn.joeg.dp.decorator.passport.old.ISignService;
import cn.joeg.dp.decorator.passport.old.ResultMsg;

public class SignForThirdService implements ISignForThirdService {


    private ISignService service;

    public SignForThirdService(ISignService iSignService) {
        this.service = iSignService;
    }

    public ResultMsg regist(String username, String password) {
        return service.regist(username, password);
    }

    public ResultMsg login(String username, String password) {
        return service.regist(username, password);
    }


    public ResultMsg loginForQQ(String openId) {
        //1.认为openId是全局唯一，可以把它当做用户名
        //2.密码默认为null
        //3.注册（在原有的系统里创建一个用户）

        //4.调用原来的登陆方法
        return loginForRegist(openId, null);
    }

    public ResultMsg loginForWechat(String openId) {

        return null;
    }

    public ResultMsg loginForToken(String token) {
        //通过token拿到用户信息，然后重新登陆一次

        return null;
    }

    public ResultMsg loginForTelphone(String telphone, String code) {
        return null;
    }


    public ResultMsg loginForRegist(String username, String password) {
        this.regist(username, password);
        return this.login(username, password);
    }


}
